﻿app.controller('HomeController', function ($scope, MoviesService) {
    $scope.greeting = "sup"

    $scope.actorList = MoviesService.myActors;

    MoviesService.getAllActors().then(function (data) {
        console.log("Get actors was called")
        for (var i in data) {
            console.log("-- names:", data[i].name)
            $scope.actorList.push(data[i])
        }

    })


    $scope.doDelete = function (id) {
        // Call the delete function from the service
        MoviesService.doDelete($scope.actorList[id].actorId);
        $scope.actorList.splice(id, 1);
    }
})